import type {
  BannerItem,
  CategoryItem,
  HotItem,
  PageResult,
  GuessItem,
  PageParams,
} from '@/types/home'
import { http } from '@/utils/http'

// 横向列表轮播列表的请求
export const getBannerListApi = (distributionSite: number = 1) => {
  return http<BannerItem[]>({
    method: 'GET',
    url: '/home/banner',
    /*data参数是http中使用的wxrequest的参数，访问的实际结果：(data会作为requstParam)
        Request URL: http://pcapi-xiaotuxian-front-devtest.itheima.net/home/banner?distributionSite=1*/
    data: {
      distributionSite,
    },
  })
}

// 分类项目的请求
export const getCategoryApi = () => {
  return http<CategoryItem[]>({
    method: 'GET',
    url: '/home/category/mutli',
  })
}

// services/home.ts
/**
 * 首页-热门推荐-小程序
 */
export const getHomeHotAPI = () => {
  return http<HotItem[]>({
    method: 'GET',
    url: '/home/hot/mutli',
  })
}
// src/services/home.ts
/**
 * 猜你喜欢-小程序
 */
export const getHomeGoodsGuessLikeAPI = (data?: PageParams) => {
  return http<PageResult<GuessItem>>({
    method: 'GET',
    url: '/home/goods/guessLike',
    data,
  })
}
